<?php
	$fields_arr = array(
		'invoice_no'=>'发货单号',
		'username'=>'买家会员号',
		'order_no'=>'订单号',
		'actual_amount'=>'销售金额(￥)',
		'delivery_time'=>'发货时间',
		'pay_way'=>'支付方式',
		'shipping_way'=>'配送方式',
	);
	if(!$custom_field_arr){
		$custom_field_arr = array_flip($fields_arr);
	}
	$fields_arr_new = array_merge($custom_field_arr,array_flip($fields_arr));
	$fields_arr_new = array_unique($fields_arr_new);
?>
{include app:admin.inc.header}
<!--tmpl-resource-->
{include app:admin.inc.top}
<link rel="stylesheet" href="/res/js/framework/nestable/nestable.css">
<div class="container-fluid content-body">
	<div class="main">
		<!-- left side start-->

		<section class="left-section">
			<dl id="leftNav" data-type="report">
				<dt><i class="glyphicon glyphicon-plus"></i> 报表管理</dt>
				{if in_case_array('admin/sale',$priv) || empty($priv)}
				<dd><a class="mbh" href="{url /admin/sale/index}">销售单列表</a></dd>
				{/if}
				{if in_case_array('admin/invoice',$priv) || empty($priv)}
				<dd><a class="mb active" href="{url /admin/invoice/index}">发货单列表</a></dd>
				{/if}
				{if in_case_array('admin/sale/ranking',$priv) || empty($priv)}
				<dd><a class="mbh" href="{url /admin/sale/ranking}">销售排行</a></dd>
				{/if}
				{if in_case_array('admin/sale/details',$priv) || empty($priv)}
				<dd><a class="mbh" href="{url /admin/sale/details}">销售明细</a></dd>
				{/if}
			</dl>
		</section>

		<!-- left side end-->


		<!-- main content start-->
		<section class="right-section" id="right-section">
			{include admin.inc.bread}
			<h2 class="header">{$title}</h2>
			<!-- start of inner-frame -->
			<div class="inner-iframe">

				<div class="inner-container">
					<form class="form-inline search-form" role="form">
						<nav class="inline-form clearfix">
							<div class="r">
								<div class="css-select-group">
									<div class="css-select">
										<div class="chosen">
											<span></span>
											<i class="angle-down"></i>
											<input type="hidden" name="select_mix_option1" value="{$search_arr[select_mix_option1]}">
										</div>
										<ul>
											<li data-value="invoice_no">发货单号</li>
											<li data-value="order_no">订单号</li>
										</ul>
									</div><input type="text" class="form-control input-sm" maxlength="{maxlength}" placeholder="关键词" name="select_mix_option_value1" value="{$search_arr[select_mix_option_value1]}">
								</div>
								<div class="css-select">
									<div class="chosen">
										<span></span>
										<i class="angle-down"></i>
										<input type="hidden" name="select_mix_option2" value="{$search_arr[select_mix_option2]}">
									</div>
									<ul>
										<li data-value="order_no">发货时间</li>
									</ul>
								</div>
								<div class="form-group">
									<div class="input-group">

										<input style="width:100px;" class="form-control form-control-inline input-sm mdate"  size="16" type="text"
											   name="start_time" value="{$search_arr[start_time]}"
											   placeholder="开始时间" />

										<div class="input-group-addon">
											-
										</div>
										<input style="width:100px;" class="form-control form-control-inline input-sm mdate"  size="16" type="text"
											   name="end_time" value="{$search_arr[end_time]}"
											   placeholder="结束时间" />
									</div>
								</div>

								<input type="hidden" name="order" value="{$order}">
								<button type="submit" class="btnlg mb">搜索</button>
								<input type="hidden" name="pagesize" value="{$pagesize}" >
								<button type="button" class="btnlg mb" id="J_Export_btn">导出Excel</button>
								<button type="button" class="btnlg mb" id="defined">配置列表项</button>
							</div>
						</nav>

					<!--</form>
					<form id="J_List_Form">-->
						<div class="table-responsive">
							<table id="J_ListTable" class="table  table-hover  table-ahover table-striped">
								<thead>
								<tr>
									<th width="20">
										<label class="css-checkbox">
											<input type="checkbox" class="check-all">
											<span></span>
										</label>
									</th>
									{loop $custom_field_arr $k $v}
									<th>{$fields_arr[$v]}</th>
									{/loop}
								</tr>
								</thead>
								<tbody>
								{if empty($items)}
								<tr>
									<td style="text-align:center;" colspan="4" class="empty-table-td">{$emptyRecord}</td>
								</tr>
								{/if}
								{loop $items $value}
								<tr>
									<td>
										<label class="css-checkbox">
											<input type="checkbox"  name="ids[]" value="{$value[id]}">
											<span></span>
										</label>
									</td>
									{loop $custom_field_arr $v}
									{if $v=='order_no'}
									<td><a href="{url /admin/order/detail.shtml?no=$value[order_no]}" target="_blank">{$value[order_no]}</a></td>
									{else}
									<td>{$value[$v]}</td>
									{/if}
									{/loop}
								</tr>
								{/loop}
							</table>
						</div>
					</form>
					<div class="text-right" style="float: right">
						{$pagemenu}
					</div>
				</div>
			</div>
		</section>
	</div>
</div>

<!--footer section start-->
{include admin.inc.footer}
<!--footer section end-->

<!--tmpl-script-->

<!-- template -->
<!--自定义start-->
<script id="defined_table" type="text/html">
	<div>
		<form id="defined_edit" class="form-horizontal">
			<input type="hidden" name="url" value="{$module}/{$action}/{$method}">
			<div class="de_title"><i></i>拖动改变顺序</div>
			<div class="cf">
				<div class="dd" id="nestable3">
					<ol class="dd-list">
						{loop $fields_arr_new $v}
						<li class="dd-item dd3-item" data-id="{$v}">
							<div class="dd-handle dd3-handle"></div><div class="dd3-content">
							<label class="css-checkbox">
								<input type="checkbox" {if in_array($v,$custom_field_arr)}checked="checked"{/if} name="field_arr[]" value="{$v}">
								<span>{$fields_arr[$v]}</span>
							</label>
						</div>
						</li>
						{/loop}
					</ol>
				</div>
			</div>
		</form>
	</div>
</script>
<!--自定义end-->

<script id="editpanel" type="text/html">
	<div>
		<form id="editpanel-form" class="form-horizontal">
			<div class="row">&nbsp</div>
			<!--tmpl-fieldlist-->

			<!-- input -->
			<div class="form-group">
				<label > </label>
				<input  dtype="" class="form-control" maxlength="{maxlength}" name="data[invoice_no]" placeholder="" required cname="" value="{[invoice_no]}" />
			</div>
			<p class="help-block"></p>
			
			<!-- input -->
			<div class="form-group">
				<label > </label>
				<input  dtype="" class="form-control" maxlength="{maxlength}" name="data[order_id]" placeholder="" required cname="" value="{[order_id]}" />
			</div>
			<p class="help-block"></p>
			

			<!--tmpl-assocfields-->
		</form>
	</div>
</script>

<!-- pagescript -->
<script type="text/javascript">
	seajs.use("admin/trading_invoiceindex",function (parameter){
		
		/**--tmpl-templatejavascript--**/
		
		<!--tmpl-templatejavascript-->
		parameter.detailUrl="{$detail_url}";
		parameter.deleteUrl="{$delete_url}";
		parameter.editUrl="{$do_edit_url}";
		parameter.upload_url="{$upload_url}";
		parameter.image_search_url="{$image_search_url}";
		parameter.image_list_url="{$image_list_url}";
		
		parameter.init();		
	});
</script>


<script id="assocpage" type="text/html">
<div class="text-right">
	<ul class="pagination blog-pagination">
		<li><a class="assoc-page" data-page="{[prev]}" href="javascript:void(0);">上一页</a></li> 
		{[loop pages page]}

		<li {[if curr == page]}class="active"{[/if]}><a class="assoc-page" data-page="{[page]}"  href="javascript:void(0)">{[page]}</a></li> 

		{[/loop]}
		<li><a class="assoc-page" href="javascript:void(0);" data-page="{[nexts]}">下一页</a></li> 
	</ul>	
</div>
</script>
</body>
</html>
